package edu.uob;

public class Condition {
    private String attributeName;
    private String comparator;
    private Object value;
    private Condition leftCondition;
    private Condition rightCondition;
    private String boolOperator;

    public Condition() {
        // Constructor
    }

    // Getters and setters
    public String getAttributeName() {
        return attributeName;
    }

    public void setAttributeName(String attributeName) {
        this.attributeName = attributeName;
    }

    public String getComparator() {
        return comparator;
    }

    public void setComparator(String comparator) {
        this.comparator = comparator;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public Condition getLeftCondition() {
        return leftCondition;
    }

    public void setLeftCondition(Condition leftCondition) {
        this.leftCondition = leftCondition;
    }

    public Condition getRightCondition() {
        return rightCondition;
    }

    public void setRightCondition(Condition rightCondition) {
        this.rightCondition = rightCondition;
    }

    public String getBoolOperator() {
        return boolOperator;
    }

    public void setBoolOperator(String boolOperator) {
        this.boolOperator = boolOperator;
    }

    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(attributeName).append(" ").append(comparator).append(" ").append(value);

        if (leftCondition != null && rightCondition != null && boolOperator != null) {
            stringBuilder.append(" ").append(boolOperator).append(" ");
            stringBuilder.append("(").append(leftCondition).append(")").append(" ").append("(").append(rightCondition).append(")");
        }

        return stringBuilder.toString();
    }
}

